package homework;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.Arrays;
import java.util.stream.Collectors;

public class number4 {
	public static void main(String[] args) throws Exception {
		FileInputStream fis = new FileInputStream("abc.txt");
		byte[] bytes = fis.readAllBytes();
		fis.close();
		String data = new String(bytes);
		String[] dataArray = data.split(" ");
		String collect = Arrays.stream(dataArray)
		.map(Integer::parseInt)
		.sorted()
		.map(String::valueOf)
		.collect(Collectors.joining(" "));
		
		FileOutputStream fos=new FileOutputStream(new File("abc.txt"));
		byte[] b=collect.getBytes();
		fos.write(b);
		fos.close();
		System.out.println("排序完成");
	}
}
